package Dome01;

public class Test {
    public static void run(Animal animal) {
        animal.eat();
    }
    public static void swimming(Swim swim) {
        swim.swim();
    }
    public static void main(String[] args) {
        swimming(new Dog("狗"));
        System.out.println("=========================");

    }
    public static void main02(String[] args) {
        Animal animal = new Dog("狗");
        run(animal);

    }
    public static void main01(String[] args) {
        Dog dog = new Dog("狗");
        dog.run();
        dog.swim();
        dog.eat();
    }
}

abstract class Animal{
    public String name;
    Animal(String name) {
        this.name = name;
    }
    abstract public void eat();
    abstract public void swim();
}

interface Run {
    public void run();
}

interface Swim {
    public void swim();
}



class Dog extends Animal implements Run,Swim {
    public Dog(String name) {
        super(name);
    }
    public void run() {
        System.out.println(this.name+"跑");
    }
    public void swim() {
        System.out.println(this.name+"游泳");
    }

    @Override
    public void eat() {
        System.out.println(this.name+"吃");
    }
}

class fish extends Animal implements Swim {
    public fish(String name) {
        super(name);
    }
    public void swim() {
        System.out.println(this.name+"游泳");
    }

    @Override
    public void eat() {
        System.out.println(this.name+"吃");
    }
}


